<?php
class lapaccountbankcontroller extends CI_Controller{
	function __construct(){
		parent::__construct();
		$this->load->helper('form');
		$this->load->library('form_validation');
		$this->load->model('lapaccountbank_model');
	}
	
	function index(){               
		
		if (isset($_POST['btnview']))
		{
			$bankcode = trim($_POST['bankcode']);
			$tglawal = trim($_POST['tglawal']);
			$tglakhr = trim($_POST['tglakhir']);
		}else{
			$bankcode = "";
			$tglawal = "";
			$tglakhr = "";
		}
		$dataprofile = array(
				'page_title' => 'Laporan > Account Bank',
				'name' => $this->session->userdata('fullname'),
				'masterbank' => $this->lapaccountbank_model->getBank(),
				'data' => $this->lapaccountbank_model->getListAccount($bankcode,$tglawal,$tglakhr),
				'tglAkhir' => $tglakhr,
				'tglAwal' => $tglawal,
				'kdbank' => $bankcode 		
			);		
		$content = array(
			'content' => 'laporan/lapaccountbank'
		);
		$this->template->load('templates/default',$content,$dataprofile);
	}
	
	function toExcel()
	{		
		$dataprofile = array
			(
				'page_title' => '',
				'name' => '',
				'masterbank' => '',
				'data' => $this->lapaccountbank_model->getListAccount(trim($_REQUEST['kodeBank']),trim($_REQUEST['tglAwal']),trim($_REQUEST['tglAkhir']))
			);			

		$this->load->view('laporan/excelaccountbank',$dataprofile);
	}
}